<?php
/**
 * Created by PhpStorm.
 * User: 徐嘉宾
 * Date: 2016/8/6
 * Time: 14:42
 */
$this->registerCssFile('@web/css/backstage.css',['depends'=>['app\assets\AppAsset']]);
$this->registerJsFile('@web/js/table.js',['depends'=>['app\assets\AppAsset']]);
$this->registerJsFile('@web/js/setHeight.js',['depends'=>['app\assets\AppAsset']]);
use yii\helpers\Url;
use yii\widgets\LinkPager;
// var_dump($admininfo);die;
?>
<script>
    function abc(m) {
        if(confirm("确认删除吗？")){
            $.get("./?r=admin/readdel" , {id : m} , function (data) {
                if (data){
                    alert("删除成功！");
                    location.href = "./?r=admin/readinginfo";
                }else{
                    alert("删除失败请重试！");
                    location.href = "./?r=admin/readinginfo";
                }
            });
        }else{
            return false;
        }
    }
</script>
<div class="box">
<div class="main">
    <!--右侧内容-->
    <div class="cont">
        <div class="title">题目概况</div>
        <div class="details">
            <div class="details_operation clearfix">
                <div class="bui_select">
                    <input type="button" value="添&nbsp;&nbsp;加" class="add" onclick="location.href = './?r=admin/readadd';">
                </div>
                <div class="fr">
                    <div class="text">
                        <span>日期：</span>
                        <div class="bui_select">
                            <select name="" id="" class="select">
                                <option value="1"><?= date("Y-m-d "); ?></option>
                            </select>
                        </div>
                    </div>
                    <div class="text">
                        <span</span>
                        <div class="bui_select">
                            <select name="" id="" class="select">
                                <option value="1">Learn to walk before you run.</option>
                            </select>
                        </div>
                    </div>
                    <div class="text">
                        <span></span>
<!--                        <input type="text" value="" class="search">-->
                    </div>
                </div>
            </div>
            <table class="table" cellspacing="0" cellpadding="0">
                <thead>
                <tr>
                    <th>文章id</th>
                    <th>题目名称</th>
                    <th>题目简介</th>
                    <th>文章小题数量</th>
                    <th>题目做过的人数</th>
                    <th>题目难度</th>
                    <th>题目二级分类</th>
                    <th>题目图片url</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <?php foreach ($readinfo as $s => $v){ ?>
                    <tr>
                        <td>
                            <?= $v['id'] ?>
                        </td>
                        <td>
                            <?= $v['title'] ?>
                        </td>
                        <td>
                            <?= $v['info'] ?>
                        </td>
                        <td>
                            <?= $v['tnum'] ?>
                        </td>
                        <td>
                            <?= $v['num'] ?>
                        </td>
                        <td>
                            <?= $v['diff'] ?>
                        </td>
                        <td>
                            <?php echo $v['class2']." ".$v['class_num']; ?>
                        </td>
                        <td>
                            <?= $v['imgurl'] ?>
                        </td>
                        <td>
                            <a class='btn' href='<?php echo Url::toRoute(['admin/readupdate','id' => $v['id']]); ?>'>修改</a>
                            <a class='btn' onclick='abc("<?= $v['id'] ?>")' href='javascript:;'>删除</a>
                        </td>
                    </tr>
                <?php } ?>
                </tbody>
            </table>
        </div>
    </div>
</div>
</div>